<script>
  const arr = []
  for (let i = 0; i < 100 * 10000; i++) {
    arr.push(i)
  }
  const length = arr.length

  console.time('for')
  let n1 = 0
  for (let i = 0; i < length; i++) {
    n1++
  }
  console.timeEnd('for'); // 2.35302734375 ms

  console.log("-------------");

  console.time('forEach')
  let n2 = 0
  arr.forEach(() => n2++)
  console.timeEnd('forEach') // 9.510009765625 ms
</script>
